import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import get from '@dfeidao/atom-web/local/get';

export default async function a003(fd: IFeidaoAiBrowserComponent) {
	const node = get(fd, 'Jx');
	console.log("fffffffffffffffff", node);

	const tupian = get(fd, 'ff');
	console.log("图片==》", node);
	// todo
	const lxr = fd.data.node.querySelector<HTMLInputElement>('[data-name="lxr"]').value;
	if (!lxr) {
		alert('请输入联系人名称');
		return;
	}

	const lxd = fd.data.node.querySelector<HTMLInputElement>('[data-name="lxd"]').value;
	if (!lxd) {
		alert('请输入联系电话名称');
		return;
	}

	const wx = fd.data.node.querySelector<HTMLInputElement>('[data-name="wx"]').value;


	const emi = fd.data.node.querySelector<HTMLInputElement>('[data-name="emi"]').value;


	const qq1 = fd.data.node.querySelector<HTMLInputElement>('[data-name="qq"]').value;

	// const data = get(fd, 'industry_domain') as { industry_domain_no: string };
	const res = await nodejs<{ code: number; result: string }>('customer-care/zj-000005/s001', {
		filter: {
			client_no: node,
			contact: lxr,
			contact_number: lxd,
			wechat_no: wx,
			mail_box: emi,
			qq: qq1,
			img_url: tupian

		}
	});
	if (res.code === 1) {
		alert('保存成功');
		window.location.reload();
	} else {
		alert('保存失败');
	}



}
